/*
 * @Description: App分享类
 * @version: 
 * @Company: 
 * @Author: ZhengZhuang
 * @Date: 2019-08-31 11:33:36
 * @LastAuthor   : zhengzhuang
 * @lastTime     : 2020-01-09 14:36:16
 */
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:C20Driver/provider/driver_information.dart';
import 'package:C20Driver/utils/wechat.dart';
import 'package:provider/provider.dart';

class AppShare {
  static Future<void> share(context, stateCode, [id]) async {
    var userId = Provider.of<DriverInformation>(context, listen: false)
        .driverInfo
        .userId;
    final option = await showModalBottomSheet(
      context: context,
      builder: (BuildContext context) {
        return Container(
          height: ScreenUtil().setWidth(320.0),
          color: Colors.white,
          child: Column(
            mainAxisAlignment: MainAxisAlignment.spaceAround,
            children: <Widget>[
              Text(
                '分享',
                style: TextStyle(
                  fontSize: ScreenUtil().setSp(36.0),
                  color: Colors.black,
                ),
              ),
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceAround,
                children: <Widget>[
                  InkWell(
                    child: Container(
                      height: ScreenUtil().setWidth(200.0),
                      width: ScreenUtil().setWidth(200.0),
                      child: Column(
                        mainAxisAlignment: MainAxisAlignment.spaceAround,
                        children: <Widget>[
                          Image.asset(
                            'assets/icon/wechatFriendsIcon.png',
                            width: ScreenUtil().setWidth(90.0),
                            height: ScreenUtil().setWidth(90.0),
                          ),
                          Text(
                            '微信好友',
                            style: TextStyle(
                              fontSize: ScreenUtil().setSp(30.0),
                              color: Colors.black87,
                            ),
                          ),
                        ],
                      ),
                    ),
                    onTap: () => Wechat.weChatShareWebSession(userId),
                  ),
                  InkWell(
                    child: Container(
                      height: ScreenUtil().setWidth(200.0),
                      width: ScreenUtil().setWidth(200.0),
                      child: Column(
                        mainAxisAlignment: MainAxisAlignment.spaceAround,
                        children: <Widget>[
                          Image.asset(
                            'assets/icon/circleFriendsIcon.png',
                            width: ScreenUtil().setWidth(90.0),
                            height: ScreenUtil().setWidth(90.0),
                          ),
                          Text(
                            '朋友圈',
                            style: TextStyle(
                              fontSize: ScreenUtil().setSp(30.0),
                              color: Colors.black87,
                            ),
                          ),
                        ],
                      ),
                    ),
                    onTap: () => Wechat.weChatShareWebTimeline(userId),
                  ),
                ],
              ),
            ],
          ),
        );
      },
    );
  }
}
